﻿using System;

// 接口A：面积方法
interface A
{
    double Area();
}

// 接口B：设置颜色方法
interface B
{
    void SetColor(string c);
}

// 接口C：继承A和B，新增体积方法
interface C : A, B
{
    void Volume();
}

// 圆柱体类：实现接口C
class Cylinder : C
{
    private double radius;
    private double height;
    private string color;
    private const double PI = Math.PI;

    public Cylinder(double radius, double height)
    {
        this.radius = radius;
        this.height = height;
        this.color = "默认颜色";
    }

    public double Area() => 2 * PI * radius * (radius + height); // 表面积：2πr(r+h)

    public void SetColor(string c) => color = c;

    public void Volume() => Console.WriteLine($"圆柱体体积：{PI * radius * radius * height:F2}");

    public override string ToString() => $"圆柱体（颜色：{color}，半径：{radius}，高：{height}）";
}

// 测试类
class Program
{
    static void Main(string[] args)
    {
        Cylinder cylinder = new Cylinder(2, 5);
        cylinder.SetColor("红色");
        Console.WriteLine(cylinder);
        Console.WriteLine($"表面积：{cylinder.Area():F2}");
        cylinder.Volume();
    }
}
